AppLogger

class AppLogger(val id: String, isEnabled: Boolean = false)

A logger logs. That is, it can write text and certain objects to a file or output stream, if it is enabled

Constructors

Link copied to clipboard
constructor(id: String, isEnabled: Boolean = false)

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val id: String
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
fun allowTogglingInUI(enableToggling: Boolean): AppLogger
Link copied to clipboard
Link copied to clipboard
fun log(lazyMessage: () -> String)
fun log(message: String)
fun log(error: Throwable)
fun log(lazyMessage: () -> String, error: Throwable)
fun log(message: String, error: Throwable)
fun log(lazyMessage: () -> String, error: Throwable, showTimestamp: Boolean)
fun log(message: String, error: Throwable, showTimestamp: Boolean)

fun log(message: String? = null, error: Throwable? = null, lazyMessage: () -> String? = null, showTimestamp: Boolean = showTimestamps)

Log a message to the log file, console, or some other mechanism.

Link copied to clipboard

Dump stack traces for all threads to the log

Link copied to clipboard
fun logObject(obj: Any?, newlines: Boolean = false)

Log a descriptive string (from stringForObject) of the given object

fun logObject(message: String?, obj: Any?, newlines: Boolean = false, linePrefix: String = "", maxLevels: Int = 3)

Log a message (if non-null) and descriptive string (from stringForObject) of the given object

Link copied to clipboard
fun logStack(thread: Thread = Thread.currentThread(), stack: Array<StackTraceElement> = thread.stackTrace, maxLevels: Int? = null)
Link copied to clipboard
fun setEnabled(enable: Boolean, notify: Boolean = true): AppLogger

Sets logging for this logger to enabled or disabled, optionally firing a notification to listeners if the value has changed

Link copied to clipboard
fun setTimestamps(showTimestamps: Boolean): AppLogger

A convenience builder method for the showTimestamps property, mostly for the sake of java callers

Link copied to clipboard
fun stringForObject(obj: Any?, newlines: Boolean = false, linePrefix: String = "", maxLevels: Int = 3, includeGetters: Boolean = true): String

Converts the given object to a string representation that is appropriate to write to a log, or present in text form in general

Link copied to clipboard
open override fun toString(): String